// This setup uses Hardhat Ignition to manage smart contract deployments.
// Learn more about it at https://hardhat.org/ignition

const { buildModule } = require("@nomicfoundation/hardhat-ignition/modules");

const DEFAULT_VOTING_DURATION = 7 * 24 * 60 * 60; // 默认投票持续时间为 7 天

module.exports = buildModule("VotingSystemModule", (m) => {
  // 定义部署时可传入的参数，默认值为 7 天
  const votingDuration = m.getParameter("votingDuration", DEFAULT_VOTING_DURATION);

  // 部署 VotingSystem 合约，并传递构造函数参数
  const votingSystem = m.contract("VotingSystem", [votingDuration]);

  return { votingSystem };
});